<template>
  <div class="container">
    <el-row>
      <el-card shadow="never">
        <div slot="header">
          <el-form :inline="true" :model="searchForm" size="small">
            <el-form-item label="ID" class="el-search-item">
              <el-input v-model="searchForm.orderSalesId" placeholder="订单管理ID" clearable></el-input>
            </el-form-item>
            <el-form-item label="创建时间" class="el-search-item">
              <el-date-picker v-model="checkedTime" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
              </el-date-picker>
            </el-form-item>
            <el-form-item class="el-search-item">
              <el-button type="success" plain icon="el-icon-search" @click="getDataList">查询</el-button>
            </el-form-item>
            <el-form-item class="el-search-item">
              <el-button v-if='hasPerm("shopping:orderSales:add")' type="primary" plain icon="el-icon-plus" @click="openAdd">新增订单管理</el-button>
            </el-form-item>
          </el-form>
        </div>
        <!--数据表格 element ui-->
        <el-table :data="tableData" :height="tableHeight" style="width: 100%">
          <el-table-column prop="orderSalesId" label="" align="center" sortable></el-table-column>
          <el-table-column prop="sysCompanyIdName" label="企业" align="center" sortable></el-table-column>
          <el-table-column prop="sysDepartmentIdName" label="部门(分公司)" align="center" sortable></el-table-column>
          <el-table-column prop="hyUserId" label="客户" align="center" sortable></el-table-column>
          <el-table-column prop="paymentMethodId" label="支付方式" align="center" sortable>
			  <template slot-scope="scope">
				  <!-- 1微信支付  2积分支付 3金币支付 4支付宝支付  9线下支付 10服务点支付 -->
				  <span v-if="scope.row.paymentMethodId == 1">微信支付</span>
				  <span v-if="scope.row.paymentMethodId == 2">积分支付</span>
				  <span v-if="scope.row.paymentMethodId == 3">金币支付</span>
				  <span v-if="scope.row.paymentMethodId == 4">支付宝支付</span>
				  <span v-if="scope.row.paymentMethodId == 9">线下支付</span>
				  <span v-if="scope.row.paymentMethodId == 10">服务点支付</span>
			  </template>
		  </el-table-column>
          <el-table-column prop="orderNo" label="订单号" align="center" sortable></el-table-column>
          <el-table-column prop="orderType" label="订单类型 2android 3ios 1pc 11批发后台" align="center" sortable></el-table-column>
          <el-table-column prop="needBilling" label="是否需要发票 0 1" align="center" sortable></el-table-column>
          <el-table-column prop="userAddressId" label="收件地址" align="center" sortable></el-table-column>
          <el-table-column prop="receiveUser" label="收货人姓名" align="center" sortable></el-table-column>
          <el-table-column prop="receiveCountry" label="国家" align="center" sortable></el-table-column>
          <el-table-column prop="receiveState" label="身份" align="center" sortable></el-table-column>
          <el-table-column prop="receiveCity" label="城市" align="center" sortable></el-table-column>
          <el-table-column prop="receiveArea" label="片区 区域路径" align="center" sortable></el-table-column>
          <el-table-column prop="receiveZip" label="邮编  柬埔寨充值类型" align="center" sortable></el-table-column>
          <el-table-column prop="receiveTelephone" label="电话 手机充值-充值号码" align="center" sortable></el-table-column>
          <el-table-column prop="receiveAddress" label="具体地址" align="center" sortable></el-table-column>
          <el-table-column prop="receiveEmail" label="邮箱" align="center" sortable></el-table-column>
          <el-table-column prop="receiveTime" label="收货时间" align="center" sortable></el-table-column>
          <el-table-column prop="logisCode" label="运单编号" align="center" sortable></el-table-column>
          <el-table-column prop="logisModelToId" label="运输方式" align="center" sortable></el-table-column>
          <el-table-column prop="logisSendTime" label="发货时间" align="center" sortable></el-table-column>
          <el-table-column prop="total" label="合计总金额 产品购物总金额" align="center" sortable></el-table-column>
          <el-table-column v-if='hasPerm("shopping:orderSales:list")' label="更多操作" align="center" width="250">
            <template slot-scope="scope">
              <el-button v-if='hasPerm("shopping:orderSales:edit")' @click="openUpdate(scope.row)" size="mini" type="text" icon="el-icon-edit">编辑</el-button>
              <el-button v-if='hasPerm("shopping:orderSales:del")' @click="deleteFun(scope.row)" size="mini" type="text" icon="el-icon-delete">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!--分页组件-->
        <el-pagination style="padding:0;text-align: center;" background @size-change="handleSizeChange" @current-change="handleCurrentChange" layout="total, sizes, prev, pager, next, jumper"
                       :current-page="pageNum" :page-sizes="[8, 15, 20]" :page-size="pageSize" :total="total">
        </el-pagination>
      </el-card>
      <!--新增用户对话框-->
      <el-dialog :title="dialog.dialogTitle" :visible.sync="dialog.visible" width="35%">
        <el-form :rules="rules" ref="orderSalesForm" :model="orderSalesForm" size="small" label-width="80px">
          <el-form-item prop="orderSalesId" label="">
            <el-input v-model="orderSalesForm.orderSalesId" placeholder="请输入" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="sysCompanyId" label="企业">
            <el-input v-model="orderSalesForm.sysCompanyId" placeholder="请输入企业" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="sysDepartmentId" label="部门(分公司)">
            <el-input v-model="orderSalesForm.sysDepartmentId" placeholder="请输入部门(分公司)" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="hyUserId" label="用户 下单人">
            <el-input v-model="orderSalesForm.hyUserId" placeholder="请输入用户 下单人" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="sellersId" label="商家id">
            <el-input v-model="orderSalesForm.sellersId" placeholder="请输入商家id" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="sellerHeadquartersId" label="总部id">
            <el-input v-model="orderSalesForm.sellerHeadquartersId" placeholder="请输入总部id" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="saleUserId" label="出售人id 二手货">
            <el-input v-model="orderSalesForm.saleUserId" placeholder="请输入出售人id 二手货" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="countryId" label="商家所在的国家id">
            <el-input v-model="orderSalesForm.countryId" placeholder="请输入商家所在的国家id" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="paymentMethodId" label="支付方式id 1微信支付  2积分支付 3金币支付 4支付宝支付  9线下支付 10服务点支付">
            <el-input v-model="orderSalesForm.paymentMethodId" placeholder="请输入支付方式id 1微信支付  2积分支付 3金币支付 4支付宝支付  9线下支付 10服务点支付" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="paymentMethodName" label="支付方式名称">
            <el-input v-model="orderSalesForm.paymentMethodName" placeholder="请输入支付方式名称" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="paymentTypesKey" label="支付方式关键字">
            <el-input v-model="orderSalesForm.paymentTypesKey" placeholder="请输入支付方式关键字" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="orderNo" label="订单号">
            <el-input v-model="orderSalesForm.orderNo" placeholder="请输入订单号" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="orderType" label="订单类型 2android 3ios 1pc 11批发后台">
            <el-input v-model="orderSalesForm.orderType" placeholder="请输入订单类型 2android 3ios 1pc 11批发后台" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="buyType" label="购买类 1普通产品 2平台支付买单 3招聘套餐购买 4手机充值卡 9平台赠品 10商家赠品">
            <el-input v-model="orderSalesForm.buyType" placeholder="请输入购买类 1普通产品 2平台支付买单 3招聘套餐购买 4手机充值卡 9平台赠品 10商家赠品" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="invoiceTitle" label="发票抬头">
            <el-input v-model="orderSalesForm.invoiceTitle" placeholder="请输入发票抬头" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="needBilling" label="是否需要发票 0 1">
            <el-input v-model="orderSalesForm.needBilling" placeholder="请输入是否需要发票 0 1" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="billingMsg" label="发票说明">
            <el-input v-model="orderSalesForm.billingMsg" placeholder="请输入发票说明" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="userAddressId" label="收件地址">
            <el-input v-model="orderSalesForm.userAddressId" placeholder="请输入收件地址" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="receiveUser" label="收货人姓名">
            <el-input v-model="orderSalesForm.receiveUser" placeholder="请输入收货人姓名" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="receiveCountry" label="国家">
            <el-input v-model="orderSalesForm.receiveCountry" placeholder="请输入国家" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="receiveState" label="身份">
            <el-input v-model="orderSalesForm.receiveState" placeholder="请输入身份" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="receiveCity" label="城市">
            <el-input v-model="orderSalesForm.receiveCity" placeholder="请输入城市" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="receiveArea" label="片区 区域路径">
            <el-input v-model="orderSalesForm.receiveArea" placeholder="请输入片区 区域路径" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="receiveZip" label="邮编  柬埔寨充值类型">
            <el-input v-model="orderSalesForm.receiveZip" placeholder="请输入邮编  柬埔寨充值类型" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="receiveTelephone" label="电话 手机充值-充值号码">
            <el-input v-model="orderSalesForm.receiveTelephone" placeholder="请输入电话 手机充值-充值号码" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="receiveAddress" label="具体地址">
            <el-input v-model="orderSalesForm.receiveAddress" placeholder="请输入具体地址" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="receiveEmail" label="邮箱">
            <el-input v-model="orderSalesForm.receiveEmail" placeholder="请输入邮箱" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="receiveTime" label="收货时间">
            <el-input v-model="orderSalesForm.receiveTime" placeholder="请输入收货时间" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="logisCode" label="运单编号">
            <el-input v-model="orderSalesForm.logisCode" placeholder="请输入运单编号" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="logisModelToId" label="运输方式">
            <el-input v-model="orderSalesForm.logisModelToId" placeholder="请输入运输方式" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="logisSendTime" label="发货时间">
            <el-input v-model="orderSalesForm.logisSendTime" placeholder="请输入发货时间" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="logisSnameMsg" label="配送区域 名称 说明">
            <el-input v-model="orderSalesForm.logisSnameMsg" placeholder="请输入配送区域 名称 说明" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="logisticsCost" label="物流费">
            <el-input v-model="orderSalesForm.logisticsCost" placeholder="请输入物流费" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="shippingTotalCost" label="购物车产品总金额">
            <el-input v-model="orderSalesForm.shippingTotalCost" placeholder="请输入购物车产品总金额" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="supplyValue" label="服务费">
            <el-input v-model="orderSalesForm.supplyValue" placeholder="请输入服务费" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="taxAmt" label="计税">
            <el-input v-model="orderSalesForm.taxAmt" placeholder="请输入计税" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="taxApplied" label="税费说明">
            <el-input v-model="orderSalesForm.taxApplied" placeholder="请输入税费说明" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="total" label="合计总金额 产品购物总金额">
            <el-input v-model="orderSalesForm.total" placeholder="请输入合计总金额 产品购物总金额" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="couponDiscountAmt" label="优惠券 节省金额 折扣">
            <el-input v-model="orderSalesForm.couponDiscountAmt" placeholder="请输入优惠券 节省金额 折扣" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="giftCertficateAmt" label="礼券/代金券 节省金额gift_Certificate">
            <el-input v-model="orderSalesForm.giftCertficateAmt" placeholder="请输入礼券/代金券 节省金额gift_Certificate" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="goldPayCount" label="金币支付 消耗金币数量">
            <el-input v-model="orderSalesForm.goldPayCount" placeholder="请输入金币支付 消耗金币数量" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="goldPayMoney" label="金币支付金额 金币抵扣金额">
            <el-input v-model="orderSalesForm.goldPayMoney" placeholder="请输入金币支付金额 金币抵扣金额" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="integralPayCount" label="积分支付">
            <el-input v-model="orderSalesForm.integralPayCount" placeholder="请输入积分支付" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="integralPayMoney" label="积分支付抵扣金额">
            <el-input v-model="orderSalesForm.integralPayMoney" placeholder="请输入积分支付抵扣金额" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="promotionMsg" label="商家促销信息">
            <el-input v-model="orderSalesForm.promotionMsg" placeholder="请输入商家促销信息" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="saveMoneyTotal" label="促销节省总金额">
            <el-input v-model="orderSalesForm.saveMoneyTotal" placeholder="请输入促销节省总金额" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="subtotal" label="需支付金额 扣除优惠券 代金券 金币支付后的金额">
            <el-input v-model="orderSalesForm.subtotal" placeholder="请输入需支付金额 扣除优惠券 代金券 金币支付后的金额" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="orderStatus" label="订单状态 1有效 2客户取消订单 3结束系统自动评论 4过期 5结束并已评论 6退货退款激活 7退货退款结束">
            <el-input v-model="orderSalesForm.orderStatus" placeholder="请输入订单状态 1有效 2客户取消订单 3结束系统自动评论 4过期 5结束并已评论 6退货退款激活 7退货退款结束" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="paymentStatus" label="支付状态 1待支付 2已经支付 0支付失败">
            <el-input v-model="orderSalesForm.paymentStatus" placeholder="请输入支付状态 1待支付 2已经支付 0支付失败" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="shippingStatus" label="出货状态 0默认 1订单审核中 2仓库出货中 3快递送货中 4客户已签收">
            <el-input v-model="orderSalesForm.shippingStatus" placeholder="请输入出货状态 0默认 1订单审核中 2仓库出货中 3快递送货中 4客户已签收" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="itemsCount" label="产品项 总数">
            <el-input v-model="orderSalesForm.itemsCount" placeholder="请输入产品项 总数" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="notes" label="备忘录">
            <el-input v-model="orderSalesForm.notes" placeholder="请输入备忘录" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="paymentTime" label="支付时间">
            <el-input v-model="orderSalesForm.paymentTime" placeholder="请输入支付时间" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="createTime" label="">
            <el-input v-model="orderSalesForm.createTime" placeholder="请输入" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="createBy" label="">
            <el-input v-model="orderSalesForm.createBy" placeholder="请输入" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="updateTime" label="">
            <el-input v-model="orderSalesForm.updateTime" placeholder="请输入" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="updateBy" label="">
            <el-input v-model="orderSalesForm.updateBy" placeholder="请输入" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="couponId" label="优惠券id">
            <el-input v-model="orderSalesForm.couponId" placeholder="请输入优惠券id" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="couponType" label="优惠券 折扣类型 1.%off 打折 2.$off 减钱">
            <el-input v-model="orderSalesForm.couponType" placeholder="请输入优惠券 折扣类型 1.%off 打折 2.$off 减钱" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="sellerOrderBillingId" label="结算id">
            <el-input v-model="orderSalesForm.sellerOrderBillingId" placeholder="请输入结算id" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="gdState" label="0 1买家归档 2卖家归档 12买卖双方都已归档">
            <el-input v-model="orderSalesForm.gdState" placeholder="请输入0 1买家归档 2卖家归档 12买卖双方都已归档" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item prop="deleted" label="0 1">
            <el-input v-model="orderSalesForm.deleted" placeholder="请输入0 1" auto-complete="off"></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialog.visible = false" size="small">取 消</el-button>
          <el-button type="primary" @click="submitFun()" :loading="loading.status" size="small">{{loading.status ? loading.SubText : loading.BtnText}}</el-button>
        </span>
      </el-dialog>
    </el-row>
  </div>
</template>
<script>
  export default {//vue3
    data() {
      return {
        // 表格数据
        tableData: [],
        // 分页数据
        total: 0,
        pageNum: 1,
        pageSize: 8,
        // 表格高度
        tableHeight: 0,
        // 用来存放日期组件所选中的值
        checkedTime: '',
        // 查询参数
        searchForm: {orderSalesId: null, startTime: null, endTime: null,},
        // 弹出层
        dialog: {flag: 0, dialogTitle: "", visible: false},
        // 菜单弹出层
        menuDialog: {dialogTitle: "", visible: false},
        // 表单参数
        orderSalesForm: {
          orderSalesId: null,
          sysCompanyId: null,
          sysDepartmentId: null,
          hyUserId: null,
          sellersId: null,
          sellerHeadquartersId: null,
          saleUserId: null,
          countryId: null,
          paymentMethodId: null,
          paymentMethodName: null,
          paymentTypesKey: null,
          orderNo: null,
          orderType: null,
          buyType: null,
          invoiceTitle: null,
          needBilling: null,
          billingMsg: null,
          userAddressId: null,
          receiveUser: null,
          receiveCountry: null,
          receiveState: null,
          receiveCity: null,
          receiveArea: null,
          receiveZip: null,
          receiveTelephone: null,
          receiveAddress: null,
          receiveEmail: null,
          receiveTime: null,
          logisCode: null,
          logisModelToId: null,
          logisSendTime: null,
          logisSnameMsg: null,
          logisticsCost: null,
          shippingTotalCost: null,
          supplyValue: null,
          taxAmt: null,
          taxApplied: null,
          total: null,
          couponDiscountAmt: null,
          giftCertficateAmt: null,
          goldPayCount: null,
          goldPayMoney: null,
          integralPayCount: null,
          integralPayMoney: null,
          promotionMsg: null,
          saveMoneyTotal: null,
          subtotal: null,
          orderStatus: null,
          paymentStatus: null,
          shippingStatus: null,
          itemsCount: null,
          notes: null,
          paymentTime: null,
          createTime: null,
          createBy: null,
          updateTime: null,
          updateBy: null,
          couponId: null,
          couponType: null,
          sellerOrderBillingId: null,
          gdState: null,
          deleted: null,
        },
        // 提交按钮文字
        loading: {status: false,BtnText: '确 定',SubText: '提交中...'},
        // 表单校验
        rules: {
          orderSalesId: [{required: true,trigger: "change",message: "请输入"}],
          sysCompanyId: [{required: true,trigger: "change",message: "请输入企业"}],
          sysDepartmentId: [{required: true,trigger: "change",message: "请输入部门(分公司)"}],
          hyUserId: [{required: true,trigger: "change",message: "请输入用户 下单人"}],
          sellersId: [{required: true,trigger: "change",message: "请输入商家id"}],
          sellerHeadquartersId: [{required: true,trigger: "change",message: "请输入总部id"}],
          saleUserId: [{required: true,trigger: "change",message: "请输入出售人id 二手货"}],
          countryId: [{required: true,trigger: "change",message: "请输入商家所在的国家id"}],
          paymentMethodId: [{required: true,trigger: "change",message: "请输入支付方式id 1微信支付  2积分支付 3金币支付 4支付宝支付  9线下支付 10服务点支付"}],
          paymentMethodName: [{required: true,trigger: "change",message: "请输入支付方式名称"}],
          paymentTypesKey: [{required: true,trigger: "change",message: "请输入支付方式关键字"}],
          orderNo: [{required: true,trigger: "change",message: "请输入订单号"}],
          orderType: [{required: true,trigger: "change",message: "请输入订单类型 2android 3ios 1pc 11批发后台"}],
          buyType: [{required: true,trigger: "change",message: "请输入购买类 1普通产品 2平台支付买单 3招聘套餐购买 4手机充值卡 9平台赠品 10商家赠品"}],
          invoiceTitle: [{required: true,trigger: "change",message: "请输入发票抬头"}],
          needBilling: [{required: true,trigger: "change",message: "请输入是否需要发票 0 1"}],
          billingMsg: [{required: true,trigger: "change",message: "请输入发票说明"}],
          userAddressId: [{required: true,trigger: "change",message: "请输入收件地址"}],
          receiveUser: [{required: true,trigger: "change",message: "请输入收货人姓名"}],
          receiveCountry: [{required: true,trigger: "change",message: "请输入国家"}],
          receiveState: [{required: true,trigger: "change",message: "请输入身份"}],
          receiveCity: [{required: true,trigger: "change",message: "请输入城市"}],
          receiveArea: [{required: true,trigger: "change",message: "请输入片区 区域路径"}],
          receiveZip: [{required: true,trigger: "change",message: "请输入邮编  柬埔寨充值类型"}],
          receiveTelephone: [{required: true,trigger: "change",message: "请输入电话 手机充值-充值号码"}],
          receiveAddress: [{required: true,trigger: "change",message: "请输入具体地址"}],
          receiveEmail: [{required: true,trigger: "change",message: "请输入邮箱"}],
          receiveTime: [{required: true,trigger: "change",message: "请输入收货时间"}],
          logisCode: [{required: true,trigger: "change",message: "请输入运单编号"}],
          logisModelToId: [{required: true,trigger: "change",message: "请输入运输方式"}],
          logisSendTime: [{required: true,trigger: "change",message: "请输入发货时间"}],
          logisSnameMsg: [{required: true,trigger: "change",message: "请输入配送区域 名称 说明"}],
          logisticsCost: [{required: true,trigger: "change",message: "请输入物流费"}],
          shippingTotalCost: [{required: true,trigger: "change",message: "请输入购物车产品总金额"}],
          supplyValue: [{required: true,trigger: "change",message: "请输入服务费"}],
          taxAmt: [{required: true,trigger: "change",message: "请输入计税"}],
          taxApplied: [{required: true,trigger: "change",message: "请输入税费说明"}],
          total: [{required: true,trigger: "change",message: "请输入合计总金额 产品购物总金额"}],
          couponDiscountAmt: [{required: true,trigger: "change",message: "请输入优惠券 节省金额 折扣"}],
          giftCertficateAmt: [{required: true,trigger: "change",message: "请输入礼券/代金券 节省金额gift_Certificate"}],
          goldPayCount: [{required: true,trigger: "change",message: "请输入金币支付 消耗金币数量"}],
          goldPayMoney: [{required: true,trigger: "change",message: "请输入金币支付金额 金币抵扣金额"}],
          integralPayCount: [{required: true,trigger: "change",message: "请输入积分支付"}],
          integralPayMoney: [{required: true,trigger: "change",message: "请输入积分支付抵扣金额"}],
          promotionMsg: [{required: true,trigger: "change",message: "请输入商家促销信息"}],
          saveMoneyTotal: [{required: true,trigger: "change",message: "请输入促销节省总金额"}],
          subtotal: [{required: true,trigger: "change",message: "请输入需支付金额 扣除优惠券 代金券 金币支付后的金额"}],
          orderStatus: [{required: true,trigger: "change",message: "请输入订单状态 1有效 2客户取消订单 3结束系统自动评论 4过期 5结束并已评论 6退货退款激活 7退货退款结束"}],
          paymentStatus: [{required: true,trigger: "change",message: "请输入支付状态 1待支付 2已经支付 0支付失败"}],
          shippingStatus: [{required: true,trigger: "change",message: "请输入出货状态 0默认 1订单审核中 2仓库出货中 3快递送货中 4客户已签收"}],
          itemsCount: [{required: true,trigger: "change",message: "请输入产品项 总数"}],
          notes: [{required: true,trigger: "change",message: "请输入备忘录"}],
          paymentTime: [{required: true,trigger: "change",message: "请输入支付时间"}],
          createTime: [{required: true,trigger: "change",message: "请输入"}],
          createBy: [{required: true,trigger: "change",message: "请输入"}],
          updateTime: [{required: true,trigger: "change",message: "请输入"}],
          updateBy: [{required: true,trigger: "change",message: "请输入"}],
          couponId: [{required: true,trigger: "change",message: "请输入优惠券id"}],
          couponType: [{required: true,trigger: "change",message: "请输入优惠券 折扣类型 1.%off 打折 2.$off 减钱"}],
          sellerOrderBillingId: [{required: true,trigger: "change",message: "请输入结算id"}],
          gdState: [{required: true,trigger: "change",message: "请输入0 1买家归档 2卖家归档 12买卖双方都已归档"}],
          deleted: [{required: true,trigger: "change",message: "请输入0 1"}],
        },
        // 所有权限数据
        treeData: [],
        // 树形控件的属性绑定对象
        treeProps: {children: 'children', label: 'label'},
        // 默认选中的节点id值
        defKeys: [],
        // 角色id
        roleId: null
      };
    },
    mounted() {
      this.$nextTick(() => {
        this.tableHeight = window.innerHeight - 205;
      });
    },
    created() {
      this.getDataList();
    },
    watch: {
      "checkedTime"(value) {
        this.searchForm.startTime = null;
        this.searchForm.endTime = null;
        if (value != null) {
          let timeArr = value.toString().split(",");
          timeArr.forEach((item,i) => {
            if(i === 0) {
              this.searchForm.startTime = item;
            }else {
              this.searchForm.endTime = item;
            }
          });
        }
      }
    },
    methods: {
      handleSizeChange(val) {
        this.pageSize = val
        this.getDataList()
      },
      handleCurrentChange(val) {
        this.pageNum = val
        this.getDataList()
      },
      // 获取订单管理列表
      getDataList() {
        this.$api.shopping_orderSales.list({
          current: this.pageNum,
          size: this.pageSize,
          orderSalesId: this.searchForm.orderSalesId,
          startTime: this.searchForm.startTime,
          endTime: this.searchForm.endTime
        }).then(res => {
          if(res.data.code === 2000) {
            this.tableData = res.data.data.records;
            this.total = res.data.data.total;
          }
        })
      },
      // 新增按钮操作
      openAdd() {
        this.dialog.flag = 0;
        this.resetForm("orderSalesForm");
        this.dialog.dialogTitle = "新增订单管理";
        this.dialog.visible = true;
      },
      // 更新按钮操作
      openUpdate(row) {
        this.dialog.flag = 1;
        this.resetForm("orderSalesForm");
        this.dialog.dialogTitle = "编辑订单管理";
        this.dialog.visible = true;
        this.getById(row.orderSalesId);
      },
      // 提交数据操作
      submitFun() {
        this.$refs.orderSalesForm.validate(valid => {
          if(valid){
            this.loading.status = true;
            this.$api.shopping_orderSales.saveOrUpdate(this.orderSalesForm,this.dialog.flag).then(res => {
              if (res.data.code === 2000) {
                this.$message.success(res.data.msg);
                if(this.dialog.flag === 0){
                  this.pageNum = 1;
                }
                this.getDataList();
                // 关闭弹框
                this.dialog.visible = false;
                // 关闭加载
                this.loading.status = false;
              }else{
                this.$message.error(res.data.msg);
                this.loading.status = false;
                return false;
              }
            })
          }
        })
      },
      // 根据id获取订单管理信息
      getById(id) {
        this.$api.shopping_orderSales.getById(id).then(res => {
          if (res.data.code === 2000) {
            this.orderSalesForm.orderSalesId = res.data.data.orderSalesId;
            this.orderSalesForm.sysCompanyId = res.data.data.sysCompanyId;
            this.orderSalesForm.sysDepartmentId = res.data.data.sysDepartmentId;
            this.orderSalesForm.hyUserId = res.data.data.hyUserId;
            this.orderSalesForm.sellersId = res.data.data.sellersId;
            this.orderSalesForm.sellerHeadquartersId = res.data.data.sellerHeadquartersId;
            this.orderSalesForm.saleUserId = res.data.data.saleUserId;
            this.orderSalesForm.countryId = res.data.data.countryId;
            this.orderSalesForm.paymentMethodId = res.data.data.paymentMethodId;
            this.orderSalesForm.paymentMethodName = res.data.data.paymentMethodName;
            this.orderSalesForm.paymentTypesKey = res.data.data.paymentTypesKey;
            this.orderSalesForm.orderNo = res.data.data.orderNo;
            this.orderSalesForm.orderType = res.data.data.orderType;
            this.orderSalesForm.buyType = res.data.data.buyType;
            this.orderSalesForm.invoiceTitle = res.data.data.invoiceTitle;
            this.orderSalesForm.needBilling = res.data.data.needBilling;
            this.orderSalesForm.billingMsg = res.data.data.billingMsg;
            this.orderSalesForm.userAddressId = res.data.data.userAddressId;
            this.orderSalesForm.receiveUser = res.data.data.receiveUser;
            this.orderSalesForm.receiveCountry = res.data.data.receiveCountry;
            this.orderSalesForm.receiveState = res.data.data.receiveState;
            this.orderSalesForm.receiveCity = res.data.data.receiveCity;
            this.orderSalesForm.receiveArea = res.data.data.receiveArea;
            this.orderSalesForm.receiveZip = res.data.data.receiveZip;
            this.orderSalesForm.receiveTelephone = res.data.data.receiveTelephone;
            this.orderSalesForm.receiveAddress = res.data.data.receiveAddress;
            this.orderSalesForm.receiveEmail = res.data.data.receiveEmail;
            this.orderSalesForm.receiveTime = res.data.data.receiveTime;
            this.orderSalesForm.logisCode = res.data.data.logisCode;
            this.orderSalesForm.logisModelToId = res.data.data.logisModelToId;
            this.orderSalesForm.logisSendTime = res.data.data.logisSendTime;
            this.orderSalesForm.logisSnameMsg = res.data.data.logisSnameMsg;
            this.orderSalesForm.logisticsCost = res.data.data.logisticsCost;
            this.orderSalesForm.shippingTotalCost = res.data.data.shippingTotalCost;
            this.orderSalesForm.supplyValue = res.data.data.supplyValue;
            this.orderSalesForm.taxAmt = res.data.data.taxAmt;
            this.orderSalesForm.taxApplied = res.data.data.taxApplied;
            this.orderSalesForm.total = res.data.data.total;
            this.orderSalesForm.couponDiscountAmt = res.data.data.couponDiscountAmt;
            this.orderSalesForm.giftCertficateAmt = res.data.data.giftCertficateAmt;
            this.orderSalesForm.goldPayCount = res.data.data.goldPayCount;
            this.orderSalesForm.goldPayMoney = res.data.data.goldPayMoney;
            this.orderSalesForm.integralPayCount = res.data.data.integralPayCount;
            this.orderSalesForm.integralPayMoney = res.data.data.integralPayMoney;
            this.orderSalesForm.promotionMsg = res.data.data.promotionMsg;
            this.orderSalesForm.saveMoneyTotal = res.data.data.saveMoneyTotal;
            this.orderSalesForm.subtotal = res.data.data.subtotal;
            this.orderSalesForm.orderStatus = res.data.data.orderStatus;
            this.orderSalesForm.paymentStatus = res.data.data.paymentStatus;
            this.orderSalesForm.shippingStatus = res.data.data.shippingStatus;
            this.orderSalesForm.itemsCount = res.data.data.itemsCount;
            this.orderSalesForm.notes = res.data.data.notes;
            this.orderSalesForm.paymentTime = res.data.data.paymentTime;
            this.orderSalesForm.createTime = res.data.data.createTime;
            this.orderSalesForm.createBy = res.data.data.createBy;
            this.orderSalesForm.updateTime = res.data.data.updateTime;
            this.orderSalesForm.updateBy = res.data.data.updateBy;
            this.orderSalesForm.couponId = res.data.data.couponId;
            this.orderSalesForm.couponType = res.data.data.couponType;
            this.orderSalesForm.sellerOrderBillingId = res.data.data.sellerOrderBillingId;
            this.orderSalesForm.gdState = res.data.data.gdState;
            this.orderSalesForm.deleted = res.data.data.deleted;
          }
        });
      },
      // 根据id删除订单管理
      deleteFun(row) {
        this.$confirm("确定删除当前订单管理吗？", "系统提示", {confirmButtonText: "确定", cancelButtonText: "取消", type: 'error'
        }).then(() =>{
          this.$api.shopping_orderSales.remove(row.orderSalesId).then(res => {
            if(res.data.code === 2000){
              this.$message.success(res.data.msg);
              this.getDataList()
            }else {
              this.$message.error(res.data.msg);
            }
          })
        }).catch(() => {
          this.$message.info("取消删除");
        });
      },
      // 清空表单
      resetForm(formName) {
        if (this.$refs[formName]) {
          this.$refs[formName].resetFields();
        }
      },
    }
  }
</script>
<style lang="less" scoped>
  .el-search-item {
    margin-bottom: 0;
  }
  .el-card/deep/.el-card__body {
    padding: 0 10px 10px 10px !important;
  }
  .el-card/deep/.el-card__header {
    border-bottom: none !important;padding: 10px 10px !important;
  }
</style>